<%@ page language="java" %>
<%@ page import="com.dps.dao.channel.Channels" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%> 
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@ taglib uri="/WEB-INF/displaytag-12.tld" prefix="display" %>

<link rel="stylesheet" type="text/css" href='theme/style.css'>

<html>
  <head>  
    <title>View List of Sub Channels</title>
  </head>

  <body>

  <script>
  	function closeWindow(){
  	//alert("Close Button Clicked");
  	self.close();
  	}
  	
  	
  	function selectedContent(){
  	


  	var obj = document.listContents.channelURL;

	var flag = 0;

    if(obj.length > 0){
  	for(i=0;i<obj.length;i++){
	  	if(obj[i].checked)
	  	{
	  	contentURL = obj[i].value;
	  	//alert(contentURL);
	  	flag = flag + 1;
	  	}
  	}
  	}
  	else if(obj.checked){
  	//alert("Single value on page.");
  	contentURL = obj.value;
	//alert(contentURL);
  	flag = flag + 1;
  	}
  	
  	if(flag == 0)
  	{alert("Please Select any content.");}else{
  	//alert(parent.listContents.contentUrl);// = contentURL;
  	window.opener.document.listContents.contentUrl.value = contentURL;
  	closeWindow();
  	}
 }

 </script>
    <body>
  <form name="listContents" action="" method="post">
  <display:table id="parent" pagesize="10" export="true" sort="list" name="subChannels" class="data_table" requestURI="viewSubChannel.do">
   
    

   
   <display:column title="Content URL">
   <input type="radio" name="channelURL" value="channel.do?channelId=<%=((Channels) parent).getChannelID()%>&selectedChannels=<%=((Channels) parent).getSelectedChannels()%>" />
   </display:column> 



      <display:column  title="ChannelName">
   <%
     String channelId = ((Channels)parent).getChannelID();
     String channelName = ((Channels)parent).getChannelName();
     String parentChannelId = (String)request.getAttribute("parentChannel");
   %>

   <a href="viewSubChannel.do?channelId=<%=channelId%>&parentChannelId=<%=parentChannelId%>"><%=channelName%></a>
      </display:column>
   
   
  </display:table>

  <Table width="100%" border="0">
  <Tr>
  	  <Td width="100%">&nbsp;
  	  </Td>
  	  <Td align="right">
		  <input type="button" name="Select" value="Select" onclick="selectedContent();" />
      </Td>
      <Td align="right">
		  <input type="button" name="Back" value="Back" onclick="history.go(-1)" />
      </Td>
      <Td align="right">
		  <input type="button" name="Close" value="Close" onclick="closeWindow();" />
      </Td>
  </Tr>
  </Table>
    </form>
      </body>
</html>
